package edu.uniquindio.prmaven.general;

import java.io.File;

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

import edu.uniquindio.prmaven.constants.ConfigurationConstants;

/**
 * Clase que nos proporciona los drivers configurados 
 * para los diferentes navegadores sobre los cuales se pueden ejecutar las pruebas 
 *  * @author DIANA
 *
 */
public class WebDriverUtil {
	
	//Metodo para FireFox
	public static FirefoxDriver getFirefoxDirver () {
		return new FirefoxDriver ();
		}
	
	//Metodo para Internet Explorer
	public static InternetExplorerDriver getInternetExplorerDriver() {
		File file = new File (LoadPropertiesUtil.getInstance().getProperty
				(ConfigurationConstants.PATH_IE_DRIVER));
		
		System.setProperty(LoadPropertiesUtil.getInstance().getProperty(
				ConfigurationConstants.SYSTEM_PROPERTY_IE), 
				file.getAbsolutePath());
		DesiredCapabilities capabilities = new DesiredCapabilities ();
		capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
		return new InternetExplorerDriver(capabilities);
	}

	//Metodo para Google Chrome
	public static ChromeDriver getGoogleChromeDriver () {
		File file = new File (LoadPropertiesUtil.getInstance().getProperty
				(ConfigurationConstants.PATH_CHROME_DRIVER));
		
		System.setProperty(LoadPropertiesUtil.getInstance().getProperty(
				ConfigurationConstants.SYSTEM_PROPERTY_CHROME), 
				file.getAbsolutePath());
		return new ChromeDriver ();
	}
}
